home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-serious-
/
programming
/
basic
/
mildred
/
mildred.lha
/
lha
/
LandTest2.lha
/
LandTest2.ascii
< prev
next >
Wrap
Text File
|
1998-12-13
|
3KB
|
154 lines
WBStartup
#Width=320
#Height=240
MCPU Processor
Mc2pCPUmode Processor
Pic$="5Ms2.IFF"
Land$="Land8.iff"
#Objects=350
#ObjWidth=16
#ObjHeight=16
MReserveShapes 65
InitBank 0,(2240+#Width)*60,$10002
CludgeBitMap 0,2240+#Width,60,8,Bank(0)
InitPalette 0,256
LoadBitMap 0,Land$,0
MReserveBitmaps 2
MBitmap 0,2240+#Width,60
MPlanar16ToBitmap 0,Bank(0),2240,60,2240+#Width,60
MBlockScroll 0,0,#Width,60,2240,0,0
MGetaShape 0,0,4,16,8
MBitmap 1,#Width,#Height
InitBank 0,#Width*#Height,$10002
CludgeBitMap 0,#Width,#Height,8,Bank(0)
Screen 0,8,0,#Width,#Height,8,0,"",0,0,0
InitPalette 1,256
LoadBitMap 0,Pic$,1
For c=0 To 63
CopyColour 0,1,c,c
Next c
ShowPalette 1
MReservec2pWindows 1
Mc2pWindow 0,#Width,#Height
MBitmapClip 1,0,0,#Width,#Height-60,On
s=1
For y=0 To 63 Step #ObjHeight
For x=0 To 63 Step #ObjWidth
If MShape(s,16,16)=0 Then End
For yy=y To y+#ObjHeight-1
For xx=64+x To 64+x+#ObjWidth-1
MPlotShape xx MOD #ObjWidth, yy MOD #ObjHeight, Point(xx,yy)
Next xx
Next yy
MMakeCookie s
s+1
Next x
Next y
Dim x.w(#Objects)
Dim y.w(#Objects)
Dim xdirection.b(#Objects)
Dim ydirection.b(#Objects)
Dim xdirectionswap.b(#Objects)
Dim ydirectionswap.b(#Objects)
For obj=1 To #Objects
x(obj)=Rnd(2220-36)+16
y(obj)=Rnd(#Height-100)+16
Repeat
xdirection(obj)=Rnd(8)-4
Until xdirection(obj)<>0
Repeat
ydirection(obj)=Rnd(6)-3
Until ydirection(obj)<>0
xdirectionswap(obj)=-xdirection(obj)
ydirectionswap(obj)=-ydirection(obj)
Next obj
speedsetting.q=1 ; Global speed multiplier
xpos.q=0
xaccelerate.q=1*speedsetting
xmomentum.q=0
xairresistance.q=0.1*speedsetting
xmaxspeed.q=16*speedsetting
ypos.q=(#Height-69)/2
yaccelerate.q=1*speedsetting
ymomentum.q=0
ymaxspeed.q=8*speedsetting
ytopdampen.q=1.9*speedsetting
ybottomdampen.q=1.65*speedsetting
ygravity.q=0.15*speedsetting
cnt.l=0
ResetTimer
While Joyb(1)=0
jh=JHoriz(1)
jv=JVert(1)
xmomentum+(xaccelerate*jh)
ymomentum+(yaccelerate*jv)
ymomentum+ygravity
If xmomentum>0
xmomentum-xairresistance
If xmomentum<0 Then xmomentum=0
Else
xmomentum+xairresistance
If xmomentum>0 Then xmomentum=0
EndIf
If xmomentum>xmaxspeed Then xmomentum=xmaxspeed
If xmomentum<-xmaxspeed Then xmomentum=-xmaxspeed
If ymomentum>ymaxspeed Then ymomentum=ymaxspeed
If ymomentum<-ymaxspeed Then ymomentum=-ymaxspeed
xpos+xmomentum
ypos+ymomentum
If ypos<0
ymomentum=-ymomentum/ytopdampen
ypos=0
EndIf
If ypos>#Height-69
ymomentum=-ymomentum/ybottomdampen
ypos=#Height-69
EndIf
If xpos<0 Then xpos=2240+xpos
If xpos>=2240 Then xpos-2240
cnt+1
MCls0
mult.q=1.0
For yy=0 To 59
xx=xpos*mult
If xx>2239 Then xx-2240
If xx<0 Then xx+2240
MScroll xx,yy,#Width,1,0,#Height-61+yy,0
mult*1.01
Next yy
For obj=1 To #Objects
x(obj)+xdirection(obj)
If x(obj)<8 OR x(obj)>2200 Then Exchange xdirection(obj),xdirectionswap(obj)
y(obj)+ydirection(obj)
If y(obj)<8 OR y(obj)>#Height-84 Then Exchange ydirection(obj),ydirectionswap(obj)
If x(obj)>xpos AND x(obj)<xpos+#Width-16
MBlit (obj MOD 16)+1,x(obj)-xpos,y(obj) ; Stencil-cut blit and add to queue
EndIf
Next obj
MBlit 0,160-8,ypos
Mc2p Bank(0)
VWait
Wend
;t=Timer
;a.q=50.0/(t/cnt)
;NPrint a
;VWait 50
;MouseWait
End